import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StaffScheduleVO, StaffScheduleForm, StaffScheduleQuery } from '@/api/nursing/staffSchedule/types';

/**
 * 查询排班信息表列表
 * @param query
 * @returns {*}
 */

export const listStaffSchedule = (query?: StaffScheduleQuery): AxiosPromise<StaffScheduleVO[]> => {
  return request({
    url: '/nursing/staffSchedule/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询排班信息表详细
 * @param scheduleId
 */
export const getStaffSchedule = (scheduleId: string | number): AxiosPromise<StaffScheduleVO> => {
  return request({
    url: '/nursing/staffSchedule/' + scheduleId,
    method: 'get'
  });
};

/**
 * 新增排班信息表
 * @param data
 */
export const addStaffSchedule = (data: StaffScheduleForm) => {
  return request({
    url: '/nursing/staffSchedule',
    method: 'post',
    data: data
  });
};

/**
 * 修改排班信息表
 * @param data
 */
export const updateStaffSchedule = (data: StaffScheduleForm) => {
  return request({
    url: '/nursing/staffSchedule',
    method: 'put',
    data: data
  });
};

/**
 * 删除排班信息表
 * @param scheduleId
 */
export const delStaffSchedule = (scheduleId: string | number | Array<string | number>) => {
  return request({
    url: '/nursing/staffSchedule/' + scheduleId,
    method: 'delete'
  });
};
